package com.link2room.bumblebee.controller.inside;


import com.link2room.bumblebee.facade.ISysOptionFacadeService;
import com.link2room.common.dto.param.base.SysOptionBaseParamDto;
import com.link2room.common.dto.result.base.BaseResultDto;
import com.link2room.common.dto.result.base.SysOptionDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 获取sysOptions
 * Created by Ln on 2016/12/20.
 */
@Api(tags = "基础配置")
@RestController
@RequestMapping("/in/SysOptions")
public class SysOptionInsideController {
    @Resource
    private ISysOptionFacadeService sysOptionFacadeService;

    @ApiOperation(value = "基础配置", response = SysOptionDto.class)
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "item",value = "item", paramType = "query", required = true),
            @ApiImplicitParam(name = "category",value = "category", paramType = "query", required = false),

    })
    @RequestMapping(method= RequestMethod.GET)
    public @ResponseBody
    BaseResultDto getSysOption(
            @RequestParam(value = "item" ,required = true) String item,
            @RequestParam(value = "category" ,required = false) String category
    ) throws Exception {
        SysOptionBaseParamDto paramDto = new SysOptionBaseParamDto();
        paramDto.setItem(item);
        paramDto.setCategory(category);
        SysOptionDto res = sysOptionFacadeService.findSysOption(paramDto);
        BaseResultDto l2rRs=new BaseResultDto();
        l2rRs.setResultCode(0);
        l2rRs.setResultInfo(res);
        return l2rRs;
    }
}
